package string;
/**
 * String 支持正则表达式的方法三
 * String repiaceAll(String regex,String str)
 * 将当前字符串中满足正则表达式的不放呢替换为给定内容
 */
public class ReplaceAllDemo {
    public static void main(String[] args) {
        String str = "adjfjfisiofj4568465415kdhfshfkl";

        /*
          指定部分替换为”520qianqian“
         */
        str = str.replaceAll("[0-9]+","520qianqian");
        System.out.println(str);
        str = str.replaceAll("[a-zA-Z]+","520qianqian");
        System.out.println(str);
        /*
           和谐用语
        */
        String regex = "(wqnmlgb|lj|nswez|gmnbb|bxe)";
        String message = "wqnmlgb!你个lj,nswez";
        message = message.replaceAll(regex,"***");
        System.out.println(message);

    }

}

